package objectAdapter;

/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: VoltageAdapter
 * @author: xiayuanxing
 * @description: 适配器类
 * @date: 2021/12/21 14:37
 * @version: 1.0
 */
public class VoltageAdapter implements IVoltage5V {

    //关联关系-聚合
    private Voltage220V voltage220V;


    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }



    public int output5V() {

        int dis = 0;

        if (voltage220V != null){
            //获取220v电压
            int src = voltage220V.output220V();

            System.out.println("使用对象适配器适配~~");

            dis = src/44;
        }

        return dis;
    }
}
